@namespace BlazorDatasheet.Render.DefaultComponents
@inherits BaseRenderer

<input type="checkbox" disabled="@Cell?.Format?.IsReadOnly" @bind="Checked"/>

@code {

    private bool _checked;
    private bool IsReadOnly { get; init; }

    public bool Checked
    {
        get { return _checked; }
        set
        {
            _checked = value;
            this.RequestChangeCellValue(_checked);
        }
    }

    protected override void OnParametersSet()
    {
        var parsed = bool.TryParse(Cell?.Value?.ToString(), out var val);
        if (!parsed)
            val = false;
        else
            _checked = val;

        base.OnParametersSet();
    }

}